﻿<Window x:Class="CPPEI.Coolzon.Designer.Views.SolutionSelectView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:CPPEI.Coolzon.Designer.Views"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300" Closing="Window_Closing" Loaded="Window_Loaded" WindowState="Normal"  WindowStartupLocation="CenterScreen" Title="选择方案" 
             Style="{DynamicResource WindowStyle}" >
    <Window.Resources>
        <local:BoolToString x:Key="BTSConverter"/>
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="35"></RowDefinition>
            <RowDefinition Height="*"></RowDefinition>
            <RowDefinition Height="35"></RowDefinition>
        </Grid.RowDefinitions>
        <StackPanel Style="{DynamicResource ButtonPanelBackground}"  Grid.Row="0" Orientation="Horizontal">
            <Button Content="新建方案" Style="{DynamicResource LongButtonStyle}" Margin="2"  Command="local:UICustomCommand.AddSolution" Click="NewSolution_Click"/>
            <Button Name="_btnRetry" Style="{DynamicResource LongButtonStyle}" Content="获取方案失败,点击重试" Height="20" Width="200" Visibility="Collapsed" Margin="3" Click="btnRetry_Click"/>
            <ComboBox x:Name="_cbLocal" Height="25" Width="100" Margin="3" SelectedIndex="0" SelectionChanged="_cbLocal_SelectionChanged">
                <TextBlock Text="本地"></TextBlock>
                <TextBlock Text="远程"/>
                <TextBlock Text="全部"></TextBlock>
            </ComboBox>
        </StackPanel>
        <Grid Grid.Row="1">
            <TextBlock x:Name="_ctlTbMessage" Text="正在获取方案列表..." Grid.Row="1" Visibility="Visible"/>
            <ListView  x:Name="_ctlwpListView"  Visibility="Collapsed"  AlternationCount="2">
                <ListView.View >
                    <GridView>
                        <GridView.Columns>
                            <GridViewColumn>
                                <GridViewColumn.HeaderTemplate>
                                    <DataTemplate>
                                        <Grid>
                                            <TextBlock HorizontalAlignment="Center" Margin="2" Text="名称"/>
                                        </Grid>
                                    </DataTemplate>
                                </GridViewColumn.HeaderTemplate>
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding Path=Name}" Margin="10"></TextBlock>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                            <GridViewColumn>
                                <GridViewColumn.HeaderTemplate>
                                    <DataTemplate>
                                        <Grid>
                                            <TextBlock HorizontalAlignment="Center" Margin="2" Text="描述"/>
                                        </Grid>
                                    </DataTemplate>
                                </GridViewColumn.HeaderTemplate>
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding Path=Caption}"/>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                            <GridViewColumn>
                                <GridViewColumn.HeaderTemplate>
                                    <DataTemplate>
                                        <Grid>
                                            <TextBlock HorizontalAlignment="Center" Margin="2" Text="版本"/>
                                        </Grid>
                                    </DataTemplate>
                                </GridViewColumn.HeaderTemplate>
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding Path=Version}"/>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                            <GridViewColumn>
                                <GridViewColumn.HeaderTemplate>
                                    <DataTemplate>
                                        <Grid>
                                            <TextBlock HorizontalAlignment="Center" Margin="2" Text="运行时版本"/>
                                        </Grid>
                                    </DataTemplate>
                                </GridViewColumn.HeaderTemplate>
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding Path=RTVersion}"/>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                            <GridViewColumn>
                                <GridViewColumn.HeaderTemplate>
                                    <DataTemplate>
                                        <Grid>
                                            <TextBlock HorizontalAlignment="Center" Margin="2" Text="是否映射本地"/>
                                        </Grid>
                                    </DataTemplate>
                                </GridViewColumn.HeaderTemplate>
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding Path=IsLocalExist, Converter={StaticResource BTSConverter}}" Margin="20,0,20,0"/>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                            <GridViewColumn>
                                <GridViewColumn.HeaderTemplate>
                                    <DataTemplate>
                                        <Grid>
                                            <TextBlock HorizontalAlignment="Center" Margin="2" Text="类型"/>
                                        </Grid>
                                    </DataTemplate>
                                </GridViewColumn.HeaderTemplate>
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding Path=Type}"/>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                            <GridViewColumn>
                                <GridViewColumn.HeaderTemplate>
                                    <DataTemplate>
                                        <Grid>
                                            <TextBlock HorizontalAlignment="Center" Margin="2" Text="修改时间"/>
                                        </Grid>
                                    </DataTemplate>
                                </GridViewColumn.HeaderTemplate>
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding Path=UpdateTime}"/>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                            <GridViewColumn>
                                <GridViewColumn.HeaderTemplate>
                                    <DataTemplate>
                                        <Grid>
                                            <TextBlock HorizontalAlignment="Center" Margin="2" Text="创建时间"/>
                                        </Grid>
                                    </DataTemplate>
                                </GridViewColumn.HeaderTemplate>
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding Path=CreateTime}"/>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                        </GridView.Columns>
                    </GridView>
                </ListView.View>
                <ListView.ItemContainerStyle>
                    <Style TargetType="{x:Type ListViewItem}">
                        <Setter Property="IsSelected" Value="{Binding IsSelected,Mode=TwoWay}" />
                        <EventSetter Event="MouseDoubleClick" Handler="ListViewItem_MouseDoubleClick"/>
                        <Style.Triggers>
                            <MultiTrigger>
                                <MultiTrigger.Conditions>
                                    <Condition Property="ItemsControl.AlternationIndex" Value="1" />
                                    <Condition Property="IsSelected" Value="False" />
                                    <Condition Property="IsMouseOver" Value="False" />
                                </MultiTrigger.Conditions>
                                <Setter Property="Background" Value="#FFE6E6E6" />
                            </MultiTrigger>
                        </Style.Triggers>
                    </Style>
                </ListView.ItemContainerStyle>
            </ListView>
        </Grid>
        <Grid Grid.Row="2">
            <StackPanel Margin="5" Orientation="Horizontal" HorizontalAlignment="Center">
                <Button Style="{DynamicResource SubmitOrCancelButtonStyle}" Content="确定" Margin="0,0,20,0" Click="Button_Click" />
                <Button Style="{DynamicResource SubmitOrCancelButtonStyle}" Name="cancel" Content="取消" Margin="20,0,0,0" Click="cancel_Click"></Button>
            </StackPanel>
        </Grid>
    </Grid>
</Window>
